home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu017.dms / pu017.adf / Screens / Example5.c < prev    next >
C/C++ Source or Header  |  1990-01-30  |  4KB  |  142 lines

  1. /* Example5                                                            */
  2. /* This program will open two screens, one (low-resolution 32 colours) */
  3. /* at the top of the display, and the other one (high-resolution 16    */
  4. /* colours) a bit further down. After 10 seconds the low-resolution    */
  5. /* screen will move down 75 lines. After another 10 seconds it will be */
  6. /* put in front of all other screens. 10 seconds later it will move    */
  7. /* down another 75 lines. The program will wait 10 seconds before the  */
  8. /* screens are closed and the program exits.                           */
  9.  
  10.  
  11. /* If your program is using Intuition you should include intuition.h: */
  12. #include <intuition/intuition.h>
  13.  
  14.  
  15.  
  16. struct IntuitionBase *IntuitionBase;
  17.  
  18.  
  19.  
  20. /* Declare two pointer to a Screen structure: */ 
  21. struct Screen *my_screen1;
  22. struct Screen *my_screen2;
  23.  
  24. /* Declare and initialize your NewScreen structure for screen 1: */
  25. struct NewScreen my_new_screen1=
  26. {
  27.   0,            /* LeftEdge  Should always be 0. */
  28.   0,            /* TopEdge   Top of the display.*/
  29.   320,          /* Width     We are using a low-resolution screen. */
  30.   100,          /* Height    */
  31.   5,            /* Depth     32 colours. */
  32.   0,            /* DetailPen Text should be drawn with colour reg. 0 */
  33.   1,            /* BlockPen  Blocks should be drawn with colour reg. 1 */
  34.   NULL,         /* ViewModes No special modes. (Low-res, Non-Interlaced) */
  35.   CUSTOMSCREEN, /* Type      Your own customized screen. */
  36.   NULL,         /* Font      Default font. */
  37.   "MY SCREEN1", /* Title     The screen' title. */
  38.   NULL,         /* Gadget    Must for the moment be NULL. */
  39.   NULL          /* BitMap    No special CustomBitMap. */
  40. };
  41.  
  42. /* Declare and initialize your NewScreen structure for screen 2: */
  43. struct NewScreen my_new_screen2=
  44. {
  45.   0,            /* LeftEdge  Should always be 0. */
  46.   105,          /* TopEdge   Top of the display.*/
  47.   640,          /* Width     We are using a low-resolution screen. */
  48.   95,           /* Height    */
  49.   4,            /* Depth     16 colours. */
  50.   0,            /* DetailPen Text should be drawn with colour reg. 0 */
  51.   1,            /* BlockPen  Blocks should be drawn with colour reg. 1 */
  52.   HIRES,        /* ViewModes High-resolution, Non-Interlaced */
  53.   CUSTOMSCREEN, /* Type      Your own customized screen. */
  54.   NULL,         /* Font      Default font. */
  55.   "MY SCREEN2", /* Title     The screen' title. */
  56.   NULL,         /* Gadget    Must for the moment be NULL. */
  57.   NULL          /* BitMap    No special CustomBitMap. */
  58. };
  59.  
  60.  
  61.  
  62. main()
  63. {
  64.   /* Open the Intuition Library: */
  65.   IntuitionBase = (struct IntuitionBase *)
  66.     OpenLibrary( "intuition.library", 0 );
  67.   
  68.   if( IntuitionBase == NULL )
  69.     exit(); /* Could NOT open the Intuition Library! */
  70.   
  71.  
  72.  
  73.   /* We will now try to open the first screen: */
  74.   my_screen1 = (struct Screen *) OpenScreen( &my_new_screen1 );
  75.   
  76.   /* Have we opened screen1 succesfully? */
  77.   if(my_screen1 == NULL)
  78.   {
  79.     /* Could NOT open the Screen1! */
  80.     
  81.     /* Close the Intuition Library since we have opened it: */
  82.     CloseLibrary( IntuitionBase );
  83.  
  84.     exit();  
  85.   }
  86.  
  87.  
  88.  
  89.   /* We will now try to open the second screen: */
  90.   my_screen2 = (struct Screen *) OpenScreen( &my_new_screen2 );
  91.   
  92.   /* Have we opened screen2 succesfully? */
  93.   if(my_screen2 == NULL)
  94.   {
  95.     /* Could NOT open Screen2! */
  96.     
  97.     /* Close Screen1 before we leave since we have opened it: */
  98.     CloseScreen( my_screen1 );
  99.     
  100.     /* Close the Intuition Library since we have opened it: */
  101.     CloseLibrary( IntuitionBase );
  102.  
  103.     exit();  
  104.   }
  105.  
  106.  
  107.  
  108.   /* We have opened the screens, and everything seems to be OK. */
  109.  
  110.   /* Wait for 10 seconds: */
  111.   Delay( 50 * 10);
  112.  
  113.   /* Move the low-resolution screen down 75 lines: */
  114.   MoveScreen( my_screen1, 0, 75 );
  115.  
  116.   /* Wait for 10 seconds: */
  117.   Delay( 50 * 10);
  118.  
  119.   /* Put the low-resolution screen in front of all other screens: */
  120.   ScreenToFront( my_screen1 );
  121.  
  122.   /* Wait for 10 seconds: */
  123.   Delay( 50 * 10);
  124.  
  125.   /* Move the low-resolution screen down another 75 lines: */
  126.   MoveScreen( my_screen1, 0, 75 );
  127.  
  128.   /* Wait for 10 seconds: */
  129.   Delay( 50 * 10);
  130.  
  131.  
  132.   /* We should always close the screens we have opened before we leave: */
  133.   CloseScreen( my_screen2 );
  134.   CloseScreen( my_screen1 );
  135.  
  136.  
  137.   
  138.   /* Close the Intuition Library since we have opened it: */
  139.   CloseLibrary( IntuitionBase );
  140.   
  141.   /* THE END */
  142. }